﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"	
    xmlns:local="clr-namespace:Faust.Andrew.MTG.Player"
	mc:Ignorable="d"
	x:Class="Faust.Andrew.MTG.Player.NotificationControl"
	x:Name="UserControl" d:DesignWidth="505" d:DesignHeight="416"
	>
	<UserControl.Resources>		
		<SolidColorBrush x:Key="ListBorder" Color="#828790"/>
		<DataTemplate x:Key="PlayersItemTemplate">
			<Grid>
				<Label Margin="0" Content="{Binding Name, Mode=Default}" d:LayoutOverrides="Width, Height" Foreground="White"/>
			</Grid>
		</DataTemplate>
		<Style x:Key="PlayersItemContainerTemplate" TargetType="{x:Type ListBoxItem}">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="Padding" Value="2,0,0,0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBoxItem}">
						<Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsSelected" Value="true">
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="true"/>
									<Condition Property="Selector.IsSelectionActive" Value="false"/>
								</MultiTrigger.Conditions>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
							</MultiTrigger>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<DataTemplate x:Key="NotificationItemTemplate">
			<Grid>
				<Label Margin="0" Content="{Binding Message, Mode=OneWay}" Foreground="{Binding NotificationType, Converter={StaticResource NotificationTypeToBrushCOnverter}, Mode=OneWay}"/>
			</Grid>
		</DataTemplate>
	</UserControl.Resources>

	<Grid x:Name="LayoutRoot" Margin="0,5,0,0">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="0.75*"/>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition Width="0.25*"/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="*"/>
			<RowDefinition Height="Auto"/>			
		</Grid.RowDefinitions>
		<ListBox Background="#7F8C8C8C" BorderBrush="{x:Null}" Foreground="White" ItemsSource="{Binding Presenter.Model.Notifications, ElementName=UserControl, Mode=Default}" Margin="0,0,0,5" ItemTemplate="{DynamicResource NotificationItemTemplate}"/>
		<GridSplitter HorizontalAlignment="Stretch" Margin="0,0,0,5" Grid.Column="1" Width="3" Background="#FF515151"/>
		<ListBox x:Name="lbPlayers" Margin="0,0,0,5" Grid.Column="2" Background="#7F8C8C8C" ItemsSource="{Binding Presenter.Model.Players, ElementName=UserControl, Mode=Default}" ItemTemplate="{DynamicResource PlayersItemTemplate}" ItemContainerStyle="{DynamicResource PlayersItemContainerTemplate}" SelectionMode="Multiple"/>
		<TextBox x:Name="txtMessage" Margin="0" Grid.Row="1" TextWrapping="Wrap"/>
		<Button x:Name="btnSend" Margin="0" Content="Send" Grid.Column="2" Grid.Row="1" IsDefault="True" Click="btnSend_Click"/>
	</Grid>
</UserControl>